package com.pw.study.flink.source;

import org.apache.flink.configuration.Configuration;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

public class TextFileSource {
    public static void main(String[] args) {
        //txtSource();
        hdfsSource();
    }
    private static void hdfsSource() {
        Configuration conf = new Configuration();
        conf.setInteger("rest.port", 20000);
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(conf);
        env.readTextFile("hdfs://hadoop162:8020/da.md").print();

        try {
            env.execute();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
private static void txtSource() {
    Configuration conf = new Configuration();
    conf.setInteger("rest.port", 20000);
    StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(conf);
    env.readTextFile("data/file").print();

    try {
        env.execute();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
}
